package com.woniu.user.controller;

import com.woniu.common.util.ResponseData;
import com.woniu.user.pojo.TUserAddr;
import com.woniu.user.service.TUserAddrService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 杜梅杰
 * @Description
 * @Date 2024/5/22 22:00
 */
@RestController
public class AddrController {
    @Autowired
    private TUserAddrService addrService;

    /**
     * 获取用户地址信息
     */
    @PostMapping("/queryAddress")
    public ResponseData<?> queryAddress(String phone) {
        List<TUserAddr> addrs = addrService.lambdaQuery()
                .eq(TUserAddr::getPhone, phone)
                .eq(TUserAddr::getState, 1)
                .list();
        return new ResponseData<>().ok(addrs);
    }
}
